<script>
	
	
var log = document.getElementById('log');

	
	 request = (typeof(XMLHttpRequest) != "undefined") ? new XMLHttpRequest() : new ActiveXObject("Msxml2.XMLHTTP");
	 request.open("GET", "ajax.php", false);
	 request.send(null);
	 if(!request.getResponseHeader("Date"))
	 {
	   cached = request;
	   request = (typeof(XMLHttpRequest) != "undefined") ? new XMLHttpRequest() : new ActiveXObject("Msxml2.XMLHTTP");
	   ifModifiedSince = cached.getResponseHeader("Last-Modified");
	   ifModifiedSince = (ifModifiedSince) ? ifModifiedSince : new Date(0); // January 1, 1970
	   request.open("GET", "ajax.php", false);
	   request.setRequestHeader("If-Modified-Since", ifModifiedSince);
	   request.send(null);
	   if(request.status == 304)
	   {
	     request = cached;
		 log.innerHTML += "cached";
	   }
	 }
 
	
</script>


<div id="log"></div>

<button onclick="a();">sdfasd</button>